package cn.com.cifi.mars.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/*
 * list集合 分页查询
 */
public class ListPageUtils {
	
	public static List<String> getPageList(List<String> list, int pageNum, int pageSize) {
		List<String> resultList = Collections.synchronizedList(new ArrayList<>());
		int currIdx = (pageNum > 1 ? (pageNum - 1) * pageSize : 0);
		if(list!= null && list.size() >0) {
			for (int i = 0; i < pageSize && i < list.size() - currIdx; i++) {
				resultList.add(list.get(currIdx + i));
			}
		}
		return resultList;
	}
}
